<?php
/**
 * 自定义表排序
 */

return array(

    array("field" => 'id', "title" => '线索ID', "sortable" => true),

    array("field" => 'name', "title" => '线索名称', "operate" => "LIKE", "align" => 'left', 'customField' => 'tags', "class" => "tabletd",
        "formatter" => '(function (value, row, index) {
         value=\'<a href="javascript:void(0);" data-url="facrm/clues/index/edit/ids/\' + row.id
             +\'" data-area="[&quot;98%&quot;,&quot;98%&quot;]" class="btn-dialog" data-title="\'+ row.name+\'">\'+ row.name+\'</a>\';
         return value +
             \'<div >\' + Table.api.formatter.flag.call(this, row[\'tags\'], row, index) + \'</div>\';
     })',
        "cellStyle" => '(function(value, row, index, field){return {css: {"max-width":"200px"}};})'),

    array("field" => 'tags', "title" => '标签', "visible" => false, "formatter" => "Table.api.formatter.flag", "operate" => 'find_in_set'),
    array("field" => 'level', "title" => '级别', "formatter" => "Table.api.formatter.status", "searchList" => 'levelList'),
    array("field" => 'industry', "title" => '行业', "formatter" => "(function (v, row, index) {
                       if(!v) return '无';
                        return industryList[v];
                    })", "searchList" => 'industryList'),

    array("field" => 'source', "title" => '来源', "formatter" => "(function (v, row, index) {
                       if(!v) return '无';
                        return sourceList[v];
                    })", "searchList" => 'sourceList'),
    array("field" => 'telephone', "title" => '电话', "operate" => "LIKE"),
    array("field" => 'mobile', "title" => '手机', "operate" => "LIKE"),

    array("field" => 'remark', "title" => '备注', "operate" => "LIKE", "class" => "tabletd", "align" => "left", "cellStyle" => "(function(value, row, index, field){
         return {css: { \"max-width\":\"250px\"}};
                    })"),
    array("field" => 'status', "title" => '状态', "formatter" => "Table.api.formatter.status", "searchList" => 'status_obj'),

    array("field" => 'owner_user_id', "title" => '负责人', "addclass" => "selectpage", "class" => "tabletd", "cellStyle" => "(function(value, row, index, field){
         return {css: { \"max-width\":\"200px\"}};
                    })",
        'formatter' => "(function (v, r) {
            if (!r.owner_user) return '-';
            return r.owner_user.nickname;})",
        'extend' => 'data-source="facrm/common/selectpage/model/admin?type=children" data-field="nickname" data-orderBy="id desc"'
    ),
    array("field" => 'create_user_id', "title" => '创建人', "addclass" => "selectpage", "formatter" => '(function (v, r) {
                    if (!r.create_user) return \'-\';
                    return r.create_user.nickname;
                })',
        "extend" => 'data-source="facrm/common/selectpage/model/admin?type=children" data-field="nickname" data-orderBy="id desc"',
    ),
    array("field" => 'next_time', "title" => '下次跟进', "operate" => "RANGE", "sortable" => true, "formatter" => "Table.api.formatter.datetime", "addclass" => "datetimerange", "extend" => 'autocomplete="off" data-time-picker="true"'),
    array("field" => 'follow_time', "title" => '最近跟进', "operate" => "RANGE", "sortable" => true, "formatter" => "Table.api.formatter.datetime", "addclass" => "datetimerange", "extend" => 'autocomplete="off" data-time-picker="true"'),
    array("field" => 'create_time', "title" => '创建时间', "operate" => "RANGE", "sortable" => true, "formatter" => "Table.api.formatter.datetime", "addclass" => "datetimerange", "extend" => 'autocomplete="off" data-time-picker="true"'),
    array("field" => 'collect_time', "title" => '领取时间', "operate" => "RANGE", "sortable" => true, "formatter" => "Table.api.formatter.datetime", "addclass" => "datetimerange", "extend" => 'autocomplete="off" data-time-picker="true"'),
    array("field" => 'update_time', "title" => '更新时间', "operate" => "RANGE", "sortable" => true, "formatter" => "Table.api.formatter.datetime", "addclass" => "datetimerange", "extend" => 'autocomplete="off" data-time-picker="true"'),



);
